﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PServiceBus.RemoteProxy;

namespace TestESBProxy {
    public class ChatRequest {
        public string UserName { get; set; }
        public string Message { get; set; }
    }
    public class ChatResponse {
        public string UserName { get; set; }
        public string Message { get; set; }
    }

    [ESBProxy]
    public interface IChatService {
        ChatResponse Execute(ChatRequest request);
    }

    class Program {
        static void Main(string[] args) {
            var service = ESBProxy.Create<IChatService>();
            Console.WriteLine("Press enter to send request");
            while (true) {
                var text = Console.ReadLine();
                if (text.ToLower() == "exit") break;
                var response = service.Execute(new ChatRequest() { Message = "Hello Server", UserName = "Client" });
                Console.WriteLine("{0}: {1}", response.UserName, response.Message);
            }
        }
    }
}
